package com.zl.tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;

import com.system.comm.util.SpringContextUtil;
import com.system.common.pojo.BisNurseType;
import com.zl.service.ZlBisNurseTypeServiceImpl;

public class BisTypeName extends BodyTagSupport{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String typeId;

	public String getTypeId() {
		return typeId;
	}

	public void setTypeId(String typeId) {
		this.typeId = typeId;
	}
	@Override
	public int doStartTag() throws JspException {
		JspWriter jspWriter=this.pageContext.getOut();
		ZlBisNurseTypeServiceImpl bisNurseTypeService=(ZlBisNurseTypeServiceImpl) SpringContextUtil.getBean("zlBisNurseTypeServiceImpl");
		try {
			if (typeId!=null||typeId.trim().equals("")) {
				BisNurseType bisNurseType=bisNurseTypeService.selectByPrimaryKey(typeId);
				if (bisNurseType==null) {
					jspWriter.write("");
				}else{
					String name=bisNurseType.getTypeName();
					jspWriter.write(name);
				}
				
			}else {
				jspWriter.write("");
			}
			
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return super.SKIP_BODY;
	}
	@Override
	public int doEndTag() throws JspException {
		// TODO Auto-generated method stub
		return super.EVAL_BODY_INCLUDE;
	}
	
	
	
	

}
